package com.lx.partitionsum;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: chenjiang
 * @Date: 2021/11/18/17:58
 * @Description:
 */
public class CovidPartitionMapper extends Mapper<LongWritable, Text, Text, Text> {
    Text outKey = new Text();

    /***
     * @param key
     * @param value
     * @param context
     * @throws IOException
     * @throws InterruptedException
     * @Desc:
     *  <br>州为key 数据为文本数据
     */
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        final String s = value.toString();
        final String keys = s.split(",")[2];
        outKey.set(keys);
        context.write(outKey, value);
    }
}
